package org.geektimes.utils;

import org.jolokia.client.*;
import org.jolokia.client.request.*;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class JolokiaDemo {

    public static void main(String[] args) throws Exception {
        J4pClient j4pClient = new J4pClient("http://localhost:8080/jolokia");
        J4pReadRequest req = new J4pReadRequest("org.geektimes.projects.user.management:name=Myself");
        J4pReadResponse resp = j4pClient.execute(req);
        Map<String,String> vals = resp.getValue();
        Set<String> sset = vals.keySet();
        Iterator<String> iter = sset.iterator();
        while(iter.hasNext()){
            String key = iter.next();
            System.out.println(key);
            System.out.println(vals.get(key));
        }
    }
}